﻿using AutoMapper;
using WomanMotion.WebApi.Model.Dtos.Action;
using WomanMotion.WebApi.Model.Dtos.Authoritys;
using WomanMotion.WebApi.Model.Dtos.Carousel;
using WomanMotion.WebApi.Model.Dtos.Classify;
using WomanMotion.WebApi.Model.Dtos.Comment;
using WomanMotion.WebApi.Model.Dtos.Contents;
using WomanMotion.WebApi.Model.Dtos.Controller;
using WomanMotion.WebApi.Model.Dtos.Match;
using WomanMotion.WebApi.Model.Dtos.Role;
using WomanMotion.WebApi.Model.Dtos.Schedule;
using WomanMotion.WebApi.Model.Dtos.SendMessage;
using WomanMotion.WebApi.Model.Dtos.SysConfig;
using WomanMotion.WebApi.Model.Dtos.Team;
using WomanMotion.WebApi.Model.Dtos.Users;
using WomanMotion.WebApi.Model.Dtos.Watch;
using WomanMotion.WebApi.Model.Entitys;
using Actions = WomanMotion.WebApi.Model.Entitys.Actions;

namespace WomanMotion.WebApi.Api.Utility
{
    /// <summary>
    /// AutoMapper配置类 CreateMap<源,目标> .ReverseMap() 双向映射
    /// </summary>
    public class MapperProfile : Profile
    {
        /// <summary>
        /// AutoMapper构造函数 创建配置 CreateMap<源,目标> .ReverseMap() 双向映射
        /// </summary>
        public MapperProfile()
        {
            CreateMap<CreatedRoleDTO, Role>().ReverseMap();
            CreateMap<UpdateRoleDTO, Role>().ReverseMap();
            CreateMap<RoleVM, Role>().ReverseMap();
            CreateMap<CreatedUserDTO, Users>().ReverseMap();
            CreateMap<UpdateUserDTO, Users>().ReverseMap();
            CreateMap<UserVM, Users>().ReverseMap();
            CreateMap<UserVM, UpdateUserDTO>().ReverseMap();
            CreateMap<CreatedClassifyDTO, Classify>().ReverseMap();
            CreateMap<UpdateClassifyDTO, Classify>().ReverseMap();
            CreateMap<ClassifyVM, Classify>().ReverseMap();
            CreateMap<CreatedTeamDTO, Team>().ReverseMap();
            CreateMap<UpdateTeamDTO, Team>().ReverseMap();
            CreateMap<TeamVM, Team>().ReverseMap();
            CreateMap<CreatedScheduleDTO, Schedule>().ReverseMap();
            CreateMap<UpdateScheduleDTO, Schedule>().ReverseMap();
            CreateMap<ScheduleVM, Schedule>().ReverseMap();
            CreateMap<CreatedMatchDTO, Match>().ReverseMap();
            CreateMap<UpdateMatchDTO, Match>().ReverseMap();
            CreateMap<MatchVM, Match>().ReverseMap();
            CreateMap<CreatedWatchDTO, Watch>().ReverseMap();
            CreateMap<UpdateWatchDTO, Watch>().ReverseMap();
            CreateMap<WatchVM, Watch>().ReverseMap();
            CreateMap<CreatedContentsDTO, Contents>().ReverseMap();
            CreateMap<UpdateContentsDTO, Contents>().ReverseMap();
            CreateMap<ContentsVM, Contents>().ReverseMap();
            CreateMap<CreatedCommentDTO, Comment>().ReverseMap();
            CreateMap<UpdateCommentDTO, Comment>().ReverseMap();
            CreateMap<CommentVM, Comment>().ReverseMap();
            CreateMap<CreatedCarouselDTO, Carousel>().ReverseMap();
            CreateMap<UpdateCarouselDTO, Carousel>().ReverseMap();
            CreateMap<CarouselVM, Carousel>().ReverseMap();
            CreateMap<CreatedSysConfigDTO, SysConfig>().ReverseMap();
            CreateMap<UpdateSysConfigDTO, SysConfig>().ReverseMap();
            CreateMap<SysConfigVM, SysConfig>().ReverseMap();
            CreateMap<CreatedControllerDTO, Controller>().ReverseMap();
            CreateMap<UpdateControllerDTO, Controller>().ReverseMap();
            CreateMap<ControllerVM, Controller>().ReverseMap();
            CreateMap<CreatedActionsDTO, Actions>().ReverseMap();
            CreateMap<UpdateActionsDTO, Actions>().ReverseMap();
            CreateMap<ActionsVM, Actions>().ReverseMap();
            CreateMap<CreatedAuthoritysDTO, Authoritys>().ReverseMap();
            CreateMap<UpdateAuthoritysDTO, Authoritys>().ReverseMap();
            CreateMap<AuthoritysVM, Authoritys>().ReverseMap();
            CreateMap<CreatedSendMessageDTO, SendMessage>().ReverseMap();
            CreateMap<UpdateSendMessageDTO, SendMessage>().ReverseMap();
            CreateMap<SendMessageVM, SendMessage>().ReverseMap();
            //CreateMap<Source, Destination>().ForMember(dest => dest.BookTitle,opts => opts.MapFrom(src => src.Title));dest代表目标 opts代表源 此代码的意思是源的字段Title映射到目标BookTitle字段
            //CreateMap<Source, Destination>().ForMember(dest => dest.Id, opt => opt.Ignore()).ReverseMap(); 此代码的意思是目标的字段Id不进行映射 忽略
        }
    }
}